"""
toolbarMaker.py

This is to create Athabaskan's toolbar.

"""

def _(s): return s

import wx
from ..utils import ImportHandler

class ToolbarHandler:
    _shared_state = {}
    
    def __init__(self):
        self.__dict__ = self._shared_state
        
    def setState(self, mainWindow):
            self.mainWindow = mainWindow
            return self
    
    def doToolbar(self):
        tb = self.mainWindow.CreateToolBar(wx.TB_HORIZONTAL | wx.NO_BORDER |
                                wx.TB_FLAT | wx.TB_TEXT)
        tsize = (24, 24)
        start_bmp =  wx.ArtProvider.GetBitmap(wx.ART_INFORMATION,
                                               wx.ART_TOOLBAR, tsize)
        restart_bmp = wx.ArtProvider.GetBitmap(wx.ART_REDO,
                                               wx.ART_TOOLBAR, tsize)
        stop_bmp = wx.ArtProvider.GetBitmap(wx.ART_MISSING_IMAGE,
                                               wx.ART_TOOLBAR, tsize)
        tb.AddSimpleTool(10, start_bmp, _("Start"), _("Start Apache"))
        #self.mainWindow.Bind(wx.EVT_TOOL, mainWindow.OnStartServer, id=10)
        tb.AddSimpleTool(20, restart_bmp, _("Restart"), _("Restart Apache"))
        #self.mainWindow.Bind(wx.EVT_TOOL, mainWindow.OnRestartServer, id=20)
        tb.AddSimpleTool(30, stop_bmp, _("Stop"), _("Stop Apache"))
        #self.mainWindow.Bind(wx.EVT_TOOL, mainWindow.OnStopServer, id=30)
        tb.AddSeparator()
        tb.Realize()
    